package com.uk;

import com.vaadin.ui.Component;
import com.vaadin.ui.Window.Notification;

public class HandleMessages {

	
	public static final String SUCCESS_SAVE = "Ruajtja u realizua me sukses !";
	
	public static void showErrorOnScreen(RuntimeException e, Component component){
		Notification error = new Notification(component.getClass().getName() + ":" + component.getCaption() + "\n" + e.getMessage(),Notification.TYPE_ERROR_MESSAGE);
		component.getWindow().showNotification(error);
	}
	public static void showErrorOnScreen(Exception e, Component component){
		Notification error = new Notification(component.getClass().getName() + ":" + component.getCaption() + "\n" + e.getMessage(),Notification.TYPE_ERROR_MESSAGE);
		component.getWindow().showNotification(error);
	}
	
	public static void showInformationOnScree(String message, Component component){
		Notification info = new Notification(message,Notification.TYPE_HUMANIZED_MESSAGE);
		info.setDelayMsec(3000);
		component.getWindow().showNotification(info);
	}
}
